using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using Devtalk.EF.CodeFirst;
using lucienneCRMApp.Migrations;

namespace lucienneCRMApp.Models
{
    public class lucienneCRMAppContext : DbContext
    {
        // You can add custom code to this file. Changes will not be overwritten.
        // 
        // If you want Entity Framework to drop and regenerate your database
        // automatically whenever you change your model schema, add the following
        // code to the Application_Start method in your Global.asax file.
        // Note: this will destroy and re-create your database with every model change.
        // 
        // System.Data.Entity.Database.SetInitializer(new System.Data.Entity.DropCreateDatabaseIfModelChanges<lucienneCRMApp.Models.lucienneCRMAppContext>());

        public DbSet<lucienneCRMApp.Models.Person> People { get; set; }
        public DbSet<lucienneCRMApp.Models.TypesModel> TypesModels { get; set; }
        public DbSet<lucienneCRMApp.Models.GuestBookEntry> GuestBookEntries { get; set; }
        
        public lucienneCRMAppContext(string connectionString)
            : base(connectionString)
        {
            
            //Database.SetInitializer<lucienneCRMAppContext>(null);
        }

        public lucienneCRMAppContext()
           
        {
            // TODO: Complete member initialization
            //Database.SetInitializer(new DontDropDbJustCreateTablesIfModelChanged<lucienneCRMAppContext>());
            //Database.SetInitializer(new MigrateDatabaseToLatestVersion<lucienneCRMAppContext, Configuration>());
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            Database.SetInitializer(new MigrateDatabaseToLatestVersion<lucienneCRMAppContext, Configuration>());
            //Database.SetInitializer<lucienneCRMAppContext>(new CreateDatabaseIfNotExists<lucienneCRMAppContext>());
            base.OnModelCreating(modelBuilder);
        }

        public DbSet<lucienneCRMApp.Models.Bookings> Bookings { get; set; }

     
    }
}